package com.treeroot.planeservice.plane.mapper;

import com.treeroot.planeservice.plane.entity.PcPlane;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.mybatis.spring.annotation.MapperScan;

import java.util.List;

/**
 * <p>
 * Mapper 接口
 * </p>
 *
 * @author TreeRoot
 * @since 2022-04-21
 */

/**
 * 0未支付1已支付
 */
public interface PcPlaneMapper extends BaseMapper<PcPlane> {
    /**
     * "UPDATE pc_plane SET flag=0 WHERE id=#{planeId}",
     * //                    剩余票数减一  原来
     * @param planeId
     */

    @Update(
            {
                    "UPDATE pc_plane set seating = seating -1 WHERE  seating !=0 AND  id = #{planeId}"}
    )
    void updateSeatingByIdOrderReduce(@Param("planeId")  String planeId );
    @Update(
            {
                    "UPDATE pc_plane_transfer set seating = seating -1 WHERE  seating !=0 AND  id = #{planeId}"}
    )
    void updateSeatingByIdOrderReduce2(@Param("planeId")  String planeId );
    @Update(
            {
                    "UPDATE pc_plane_connecting set seating = seating -1 WHERE  seating !=0 AND  id = #{planeId}"}
    )
    void updateSeatingByIdOrderReduce3(@Param("planeId")  String planeId );




    @Update(
            "UPDATE pc_plane set seating = seating +1 WHERE   id = #{planeId};"
    )
    void updateFlagByIdOrderAdd(@Param("planeId") String planeId);


    @Update(
            "UPDATE pc_plane_transfer set seating = seating +1 WHERE   id = #{planeId};"
    )
    void updateFlagByIdOrderAdd2(@Param("planeId") String planeId);


    @Update(
            "UPDATE pc_plane_connecting set seating = seating +1 WHERE   id = #{planeId};"
    )
    void updateFlagByIdOrderAdd3(@Param("planeId") String planeId);





}
